//
//  HYCPushAllFreeCell.m
//  FamilyTravel
//
//  Created by dllo on 15/10/28.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "HYCPushAllFreeCell.h"
#import <UIImageView+WebCache.h>
#import "HYCHeadDocument.h"

#define WIDTH self.contentView.frame.size.width
#define HEIFGT self.contentView.frame.size.height
@implementation HYCPushAllFreeCell


- (void)dealloc {
    [_comlabel release];
    [_hotImageView release];
    [_hotlabel release];
    [_hotView release];
    [_workLabel release];
    [_model release];
    
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}
- (void)createCell{
    
    self.hotView = [[UIView alloc] init];
    [self.contentView addSubview:self.hotView];
    [_hotView release];
//    self.hotView.backgroundColor = [UIColor yellowColor];
    
    self.hotImageView = [[UIImageView alloc] init];
    [self.hotView addSubview:self.hotImageView];
    self.hotImageView.layer.borderWidth = 1;
    self.hotImageView.layer.cornerRadius = 10;
    self.hotImageView.layer.masksToBounds = YES;
    [_hotImageView release];
    

    
    self.hotlabel = [[UILabel alloc] init];
    [self.hotView addSubview:self.hotlabel];
    self.hotlabel.font = [UIFont systemFontOfSize:17];
    self.hotlabel.numberOfLines = 0;
    [_hotlabel release];
    //    self.hotlabel.backgroundColor = [UIColor redColor];
    
    self.comlabel = [[UILabel alloc] init];
    [self.hotView addSubview:self.comlabel];
    self.comlabel.font = [UIFont systemFontOfSize:12];
    [_comlabel release];
    self.comlabel.textColor = [UIColor redColor];

    
    self.workLabel = [[UILabel alloc] init];
    [self.hotView addSubview:self.workLabel];
    self.workLabel.font = [UIFont systemFontOfSize:12];
    self.workLabel.textColor = [UIColor redColor];
    [_workLabel release];
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.hotView.frame = CGRectMake(0 , 0, WIDTH, HEIFGT);
    self.hotImageView.frame = CGRectMake(5, 5, WIDTH / 3, HEIFGT / 1.078);
    self.hotlabel.frame = CGRectMake(WIDTH / 2.344, HEIFGT / 8.98, WIDTH / 1.875, HEIFGT / 1.497);
    self.workLabel.frame = CGRectMake(WIDTH / 1.29, HEIFGT / 1.225, WIDTH / 5.357, HEIFGT / 6.7375);
    self.comlabel.frame = CGRectMake(WIDTH / 2.3437, HEIFGT / 1.225, WIDTH / 8, HEIFGT / 6.7375);
    
}


#pragma mark -  Setter Method


- (void)setModel:(HYCPushAllFreeModel *)model {
    
    if (_model != model) {
        [_model release];
        _model = [model retain];
        
        [_hotImageView sd_setImageWithURL:[NSURL URLWithString:_model.photo]placeholderImage:[UIImage imageNamed:@"zw.png"]];
        
        NSString *str = [_model.price stringByReplacingOccurrencesOfString:@"<em>" withString:@""];
        NSString *str1 = [str stringByReplacingOccurrencesOfString:@"</em>" withString:@""];
        
        _workLabel.text = str1;
        
        
        _hotlabel.text = _model.title;
        _comlabel.text = _model.priceoff;
        
        
    }
}







- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
